//
//  LoginView.swift
//  hunan_ios_ldnsm
//
//  Created by I-Q-I on 2019/4/28.
//  Copyright © 2019 I-Q-I. All rights reserved.
//

import UIKit

class RegisterView: UIView {
    var sendButton: UIButton!


     lazy var phoneInput: UITextField = {
        let el = UITextField()
        el.borderStyle = UITextField.BorderStyle.none
        el.tintColor = UIColor.colHui
        el.keyboardType = UIKeyboardType.phonePad
        el.font = UIFont.middle
        el.placeholder = "请输入您的手机号"
        sendButton = UIButton(frame:CGRect(x:0,y:0,width:90,height:36))
        sendButton.titleLabel?.font = UIFont.little
        sendButton.setTitle("获取验证码", for: .normal)
        sendButton.setTitleColor(UIColor.colGray, for: .normal)
        el.rightView = sendButton
        el.rightViewMode = .always
        return el
    }()
    
     lazy var phoneInputBottom: UIView = {
        let el = UIView()
        el.backgroundColor =  UIColor.colHuiwhite
        return el
    }()
    
     lazy var codeInput: UITextField = {
        let el = UITextField()
        el.borderStyle = UITextField.BorderStyle.none
        el.tintColor = UIColor.colHui
        el.font = UIFont.middle
        el.placeholder = "请输入验证码"
        return el
    }()
    
     lazy var codeInputBottom: UIView = {
        let el = UIView()
        el.backgroundColor = UIColor.colHuiwhite
        return el
    }()
    
     lazy var pwdInput: UITextField = {
        let el = UITextField()
        el.isSecureTextEntry = true
        el.borderStyle = UITextField.BorderStyle.none
        el.tintColor = UIColor.colHui
        el.font = UIFont.middle
        el.placeholder = "请输入登录密码"
        return el
    }()
    
     lazy var pwdInputBottom: UIView = {
        let el = UIView()
        el.backgroundColor =  UIColor.colHuiwhite
        return el
    }()
    
     lazy var loginBtn: UIButton = {
        let el = UIButton(type: .system)
        el.titleLabel?.font = UIFont.middle
        el.setTitle("注册", for: .normal)
        el.backgroundColor = UIColor.colOrange
        el.setTitleColor(UIColor.white, for: .normal)
        return el
    }()
     lazy var backBtn: UIButton = {
        let el = UIButton(type: .system)
        el.titleLabel?.font =  UIFont.little
        el.setTitle("已有账号，立即登录", for: .normal)
        el.setTitleColor(UIColor.colBlack, for: .normal)
        return el
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.backgroundColor = UIColor.white
        
        self.addSubview(phoneInput)
        phoneInput.snp.makeConstraints{
            $0.height.equalTo(size40)
            $0.right.equalTo(-size20)
            $0.left.equalTo(size20)
            $0.top.equalTo(size25)
        }
        
        self.addSubview(phoneInputBottom)
        phoneInputBottom.snp.makeConstraints{
            $0.height.equalTo(0.5)
            $0.right.left.equalTo(phoneInput)
            $0.top.equalTo(phoneInput.snp.bottom).offset(0)
        }
        
        self.addSubview(codeInput)
        codeInput.snp.makeConstraints{
            $0.height.equalTo(size40)
            $0.right.equalTo(-size20)
            $0.left.equalTo(size20)
            $0.top.equalTo(phoneInput.snp.bottom).offset(size15)
        }
        
        self.addSubview(codeInputBottom)
        codeInputBottom.snp.makeConstraints{
            $0.height.equalTo(0.5)
            $0.right.left.equalTo(phoneInput)
            $0.top.equalTo(codeInput.snp.bottom).offset(0)
        }
        
        self.addSubview(pwdInput)
        pwdInput.snp.makeConstraints{
            $0.height.equalTo(size40)
            $0.right.equalTo(-size20)
            $0.left.equalTo(size20)
            $0.top.equalTo(codeInput.snp.bottom).offset(size15)
        }
        
        self.addSubview(pwdInputBottom)
        pwdInputBottom.snp.makeConstraints{
            $0.height.equalTo(0.5)
            $0.right.left.equalTo(phoneInput)
            $0.top.equalTo(pwdInput.snp.bottom).offset(0)
        }
        
        self.addSubview(loginBtn)
        loginBtn.snp.makeConstraints{
            $0.height.equalTo(size40)
            $0.right.equalTo(-size20)
            $0.left.equalTo(size20)
            $0.top.equalTo(pwdInputBottom.snp.bottom).offset(size40)
        }
        self.addSubview(backBtn)
        backBtn.snp.makeConstraints{
            $0.left.equalTo(loginBtn)
            $0.top.equalTo(loginBtn.snp.bottom).offset(size10)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }


    
}
